<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core">

    <ui:composition template="/template.xhtml">
        <ui:define name="title">
            <h:outputText value="#{bundle.EditMenuTitle}"></h:outputText>
        </ui:define>
        <ui:define name="body">
            <h:panelGroup styleClass="edit" layout="block">
                <h:panelGrid columns="2">
                    <h:outputLabel value="#{bundle.EditMenuLabel_nom}" for="nom" />
                    <h:inputText id="nom" value="#{menuController.selected.nom}" title="#{bundle.EditMenuTitle_nom}" required="true" requiredMessage="#{bundle.EditMenuRequiredMessage_nom}"/>
                    <h:outputLabel value="#{bundle.EditMenuLabel_montant}" for="montant" />
                    <h:inputText id="montant" value="#{menuController.selected.montant}" title="#{bundle.EditMenuTitle_montant}" required="true" requiredMessage="#{bundle.EditMenuRequiredMessage_montant}"/>
                    <h:outputLabel value="#{bundle.EditMenuLabel_dateDebut}" for="dateDebut" />
                    <h:inputText id="dateDebut" value="#{menuController.selected.dateDebut}" title="#{bundle.EditMenuTitle_dateDebut}" required="true" requiredMessage="#{bundle.EditMenuRequiredMessage_dateDebut}">
                        <f:convertDateTime pattern="MM/dd/yyyy" />
                    </h:inputText>
                    <h:outputLabel value="#{bundle.EditMenuLabel_promotion}" for="promotion" />
                    <h:inputText id="promotion" value="#{menuController.selected.promotion}" title="#{bundle.EditMenuTitle_promotion}" />

                    <h:outputLabel value="#{bundle.CreateMenuLabel_produits}" for="tousLesProduits" />
                    <h:panelGrid columns="3">
                        <h:outputText value="Tous les produits"/>
                        <h:outputText value="Action"/>
                        <h:outputText value="Produits du menu"/>
                        <h:selectManyListbox id="tousLesProduits" value="#{menuController.produitsAAjouter}" size="10" >
                            <f:selectItems value="#{menuController.tousLesProduits}"
                                           var="availableProduit" itemLabel="#{availableProduit.nom}" itemValue="#{availableProduit}"/>
                        </h:selectManyListbox>

                        <h:panelGrid columns="1">
                            <h:commandLink value="Ajouter Produits &gt;&gt;" action="#{menuController.ajouterItemsProduit()}"/>
                            <h:commandLink value="&lt;&lt; Enlever produits" action="#{menuController.enleverItemsProduit()}"/>
                        </h:panelGrid>

                        <h:selectManyListbox id="produits" value="#{menuController.produitsAEnlever}" size="10" >
                            <f:selectItems value="#{menuController.produitsDuMenu}"
                                           var="availableProduit" itemLabel="#{availableProduit.nom}" itemValue="#{availableProduit}"/>
                        </h:selectManyListbox>
                    </h:panelGrid>

                </h:panelGrid>



                <h:panelGroup styleClass="boutons" layout="block">
                    <br />
                    <h:commandLink styleClass="enregistrer" action="#{menuController.update}" value="#{bundle.EditMenuSaveLink}"/>
                    <br />
                    <br />
                    <h:commandLink styleClass="retour" action="#{menuController.prepareList}" value="#{bundle.CreateMenuShowAllLink}" immediate="true"/>
                </h:panelGroup>
            </h:panelGroup>
        </ui:define>
    </ui:composition>

</html>
